<template>
  <div class="app-container">
    <!--工具栏-->
    <div class="head-container">
      <div v-if="crud.props.searchToggle">
        <!-- 搜索 -->
        <label class="el-form-item-label">客户产品代码</label>
        <el-input v-model="query.custPrdCode" clearable placeholder="客户产品代码" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
        <label class="el-form-item-label">托管行产品代码</label>
        <el-input v-model="query.productCode" clearable placeholder="托管行产品代码" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
        <label class="el-form-item-label">客户产品名称</label>
        <el-input v-model="query.custPrdName" clearable placeholder="客户产品名称" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
        <rrOperation :crud="crud" />
      </div>
      <!--如果想在工具栏加入更多按钮，可以使用插槽方式， slot = 'left' or 'right'-->
      <crudOperation :permission="permission" />
      <!--表单组件-->
      <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px">
        <el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
          <el-form-item label="id" prop="id">
            <el-input v-model="form.id" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="客户产品代码" prop="custPrdCode">
            <el-input v-model="form.custPrdCode" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="托管行产品代码" prop="productCode">
            <el-input v-model="form.productCode" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="客户产品名称">
            <el-input v-model="form.custPrdName" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="管理人机构号">
            <el-input v-model="form.manageId" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="管理人userid">
            <el-input v-model="form.manageeUserId" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="金额">
            <el-input v-model="form.amount" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="收付方向">
            <el-input v-model="form.direction" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="付款账号">
            <el-input v-model="form.creditAccount" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="付款账号名称">
            <el-input v-model="form.creditAccountName" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="付款账号开户行号">
            <el-input v-model="form.bankId" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="付款账号开户行名">
            <el-input v-model="form.bankName" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="收款账号">
            <el-input v-model="form.debitAccount" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="收款账号名称">
            <el-input v-model="form.debitAccountName" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="收款账号开户行号">
            <el-input v-model="form.fbankId" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="收款账号开户行名">
            <el-input v-model="form.fbankName" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="指令支付日期">
            <el-input v-model="form.paymentDate" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="划款事由">
            <el-input v-model="form.paymentReason" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="附言">
            <el-input v-model="form.fuyan" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="划款类型">
            <el-input v-model="form.paymentTypeId" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="流水号">
            <el-input v-model="form.custInstructionNo" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="行内外标识 可选值：1-行内支付；2-跨行支付">
            <el-input v-model="form.interBank" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="证券代码">
            <el-input v-model="form.zqdm" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="付款账户币种">
            <el-input v-model="form.creditCurrency" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="收款账户币种">
            <el-input v-model="form.debitCurrency" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="优先级 0-普通 1-高 2-紧急 3-最高">
            <el-input v-model="form.priority" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="理财产品代码">
            <el-input v-model="form.financeProductId" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="理财产品代码名称">
            <el-input v-model="form.financeProductName" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="备注1">
            <el-input v-model="form.bz1" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="备注2">
            <el-input v-model="form.bz2" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="备注3">
            <el-input v-model="form.bz3" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="备注4">
            <el-input v-model="form.bz4" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="备注5">
            <el-input v-model="form.bz5" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="备注6">
            <el-input v-model="form.bz6" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="指令模式 0未上线 1已上线">
            <el-input v-model="form.zltype" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="渠道 2-电子">
            <el-input v-model="form.source" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="生成方式 SZT/TGT/CZXT/kfpt">
            <el-input v-model="form.generate" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="createTime">
            <el-input v-model="form.createTime" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="updateTime">
            <el-input v-model="form.updateTime" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="同城标志 可选值：0-否；1-是">
            <el-input v-model="form.sameCity" style="width: 370px;" />
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button type="text" @click="crud.cancelCU">取消</el-button>
          <el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
        </div>
      </el-dialog>
      <!--表格渲染-->
      <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
        <el-table-column type="selection" width="55" />
        <el-table-column prop="id" label="id" />
        <el-table-column prop="custPrdCode" label="客户产品代码" />
        <el-table-column prop="productCode" label="托管行产品代码" />
        <el-table-column prop="custPrdName" label="客户产品名称" />
        <el-table-column prop="manageId" label="管理人机构号" />
        <el-table-column prop="manageeUserId" label="管理人userid" />
        <el-table-column prop="amount" label="金额" />
        <el-table-column prop="direction" label="收付方向" />
        <el-table-column prop="creditAccount" label="付款账号" />
        <el-table-column prop="creditAccountName" label="付款账号名称" />
        <el-table-column prop="bankId" label="付款账号开户行号" />
        <el-table-column prop="bankName" label="付款账号开户行名" />
        <el-table-column prop="debitAccount" label="收款账号" />
        <el-table-column prop="debitAccountName" label="收款账号名称" />
        <el-table-column prop="fbankId" label="收款账号开户行号" />
        <el-table-column prop="fbankName" label="收款账号开户行名" />
        <el-table-column prop="paymentDate" label="指令支付日期" />
        <el-table-column prop="paymentReason" label="划款事由" />
        <el-table-column prop="fuyan" label="附言" />
        <el-table-column prop="paymentTypeId" label="划款类型" />
        <el-table-column prop="custInstructionNo" label="流水号" />
        <el-table-column prop="interBank" label="行内外标识 可选值：1-行内支付；2-跨行支付" />
        <el-table-column prop="zqdm" label="证券代码" />
        <el-table-column prop="creditCurrency" label="付款账户币种" />
        <el-table-column prop="debitCurrency" label="收款账户币种" />
        <el-table-column prop="priority" label="优先级 0-普通 1-高 2-紧急 3-最高" />
        <el-table-column prop="financeProductId" label="理财产品代码" />
        <el-table-column prop="financeProductName" label="理财产品代码名称" />
        <el-table-column prop="bz1" label="备注1" />
        <el-table-column prop="bz2" label="备注2" />
        <el-table-column prop="bz3" label="备注3" />
        <el-table-column prop="bz4" label="备注4" />
        <el-table-column prop="bz5" label="备注5" />
        <el-table-column prop="bz6" label="备注6" />
        <el-table-column prop="zltype" label="指令模式 0未上线 1已上线" />
        <el-table-column prop="source" label="渠道 2-电子" />
        <el-table-column prop="generate" label="生成方式 SZT/TGT/CZXT/kfpt" />
        <el-table-column prop="createTime" label="createTime">
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.createTime) }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="updateTime" label="updateTime">
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.updateTime) }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="sameCity" label="同城标志 可选值：0-否；1-是" />
        <el-table-column v-permission="['admin','transferOrder:edit','transferOrder:del']" label="操作" width="150px" align="center">
          <template slot-scope="scope">
            <udOperation
              :data="scope.row"
              :permission="permission"
            />
          </template>
        </el-table-column>
      </el-table>
      <!--分页组件-->
      <pagination />
    </div>
  </div>
</template>

<script>
import crudTransferOrder from '@/api/biz/transferOrder'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'

const defaultCrud = CRUD({ title: 'TransferOrder', url: 'api/biz/transferOrder', idField: 'id', sort: 'id,desc', crudMethod: { ...crudTransferOrder }})
const defaultForm = { id: null, custPrdCode: null, productCode: null, custPrdName: null, manageId: null, manageeUserId: null, amount: null, direction: null, creditAccount: null, creditAccountName: null, bankId: null, bankName: null, debitAccount: null, debitAccountName: null, fbankId: null, fbankName: null, paymentDate: null, paymentReason: null, fuyan: null, paymentTypeId: null, custInstructionNo: null, interBank: null, zqdm: null, creditCurrency: null, debitCurrency: null, priority: null, financeProductId: null, financeProductName: null, bz1: null, bz2: null, bz3: null, bz4: null, bz5: null, bz6: null, zltype: null, source: null, generate: null, tenId: null, instructionNo: null, parentInstructionNo: null, status: null, errorMessage: null, createTime: null, updateTime: null, sameCity: null }
export default {
  name: 'TransferOrder',
  components: { pagination, crudOperation, rrOperation, udOperation },
  mixins: [presenter(defaultCrud), header(), form(defaultForm), crud()],
  data() {
    return {
      permission: {
        add: ['admin', 'transferOrder:add'],
        edit: ['admin', 'transferOrder:edit'],
        del: ['admin', 'transferOrder:del']
      },
      rules: {
        id: [
          { required: true, message: '不能为空', trigger: 'blur' }
        ],
        custPrdCode: [
          { required: true, message: '客户产品代码不能为空', trigger: 'blur' }
        ],
        productCode: [
          { required: true, message: '托管行产品代码不能为空', trigger: 'blur' }
        ]
      },
      queryTypeOptions: [
        { key: 'custPrdCode', display_name: '客户产品代码' },
        { key: 'productCode', display_name: '托管行产品代码' },
        { key: 'custPrdName', display_name: '客户产品名称' }
      ]
    }
  },
  methods: {
    // 钩子：在获取表格数据之前执行，false 则代表不获取数据
    [CRUD.HOOK.beforeRefresh]() {
      return true
    }
  }
}
</script>

<style scoped>

</style>
